import java.util.ArrayList;
import java.util.List;

public class WechatGroupSubject implements Subject{

    //微信群聊中的用户 观察者
    private List<Observer> observerList = new ArrayList<>();

    public void attach(Observer observer) {
        observerList.add(observer);
    }

    public void detach(Observer observer) {
        observerList.remove(observer);
    }

    public void notify(String message) {
        for (Observer observer : observerList) {
            observer.update(message);
        }
    }
}
